<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>农汇购-个人信息</title>
<link href="${pageContext.request.contextPath }/css/bootstrap.min.css" rel="stylesheet">
<link href="${pageContext.request.contextPath }/layui/css/layui.css" rel="stylesheet">
<script src="${pageContext.request.contextPath }/js/jquery.min.js"></script>
<script src="${pageContext.request.contextPath }/js/bootstrap.min.js"></script>
<script src="${pageContext.request.contextPath }/layui/layui.js"></script>
<script type="text/javascript">
layui.use('form', function(){
  var form = layui.form;
  
});
function xxx(){
    $.ajax({
    	url:"/rj2002/admin/changePhone",
    	type:"post",
    	data:{
    		"phone":$("#phone").val()
    	},
    	success:function(e){
    		layer.msg(e.data, {icon: 1},{time:1});
    	},
    	error:function(e){
    		layer.msg(e.data, {icon: 5},{time:1});
    	}
    });
}
function biu(){
	var cont = `<div class="layui-form-item">
		<label class="layui-form-label" style="width:100px">旧密码：</label>
		<div class="layui-input-block">
		  <input type="text" id="p1" value="" class="layui-input">
		</div>
	 </div>
	 <div class="layui-form-item">
	 	<label class="layui-form-label" style="width:100px">新密码：</label>
	 	<div class="layui-input-block">
	 	  <input type="text" id="p2" value="" class="layui-input">
	 	</div>
	  </div>
	  <div class="layui-form-item">
	  	<label class="layui-form-label" style="width:100px">确认密码：</label>
	  	<div class="layui-input-block">
	  	  <input type="text" id="p3" value="" class="layui-input">
	  	</div>
	   </div>`;
	layer.open({
	  content: cont
	  ,area:['300px','300px']
	  ,btn: ['确认修改', '告辞']
	  ,yes: function(index, layero){
		  var p1 = $("#p1").val()
		  var p2 = $("#p2").val()
		  var p3 = $("#p3").val()
		  if(p1 != "" && p2 != "" && p3 != ""){
			  if(p2 != p3){
				  layer.msg("新密码与确认密码不一致！");
				  return;
			  }else{
				  //发请求修改密码
				  $.ajax({
			    	url:"/rj2002/admin/changePwd",
			    	type:"post",
			    	data:{
			    		"oldpwd":p1,
			    		"newpwd":p2
			    	},
			    	success:function(e){
			    		layer.msg(e.data, {icon: 1},{time:1});
			    	},
			    	error:function(e){
			    		layer.msg(e.data, {icon: 5},{time:1});
			    	}
			    });
			  }
		  }else{
			  layer.msg("三者内容都为必填项！");
			  return;
		  }
	  }
	  ,btn2: function(index, layero){
	  }
	  
	});
}
</script>
</head>
<body>



	<form class="layui-form" action="">
		<div class="layui-form-item">
		    <label class="layui-form-label">账号</label>
		    <div class="layui-input-block">
		      <input type="text" value="${account.account}" readonly="readonly" class="layui-input">
		    </div>
		  </div>
		  
		  <div class="layui-form-item">
		    <label class="layui-form-label">角色</label>
		    <div class="layui-input-block">
		      <input type="text" value="${account.role==0?'买家':account.role==1?'卖家':'管理员'}" readonly="readonly" class="layui-input">
		    </div>
		  </div>
	
	
	  <div class="layui-form-item">
	    <label class="layui-form-label">电话</label>
	    <div class="layui-input-block">
	      <input type="text" id="phone" name="phone" value="${account.phone}" required  lay-verify="required" autocomplete="off" class="layui-input">
	    </div>
	  </div>
	  
	  <!--  <div class="layui-form-item">
	    <label class="layui-form-label">密码框</label>
	    <div class="layui-input-inline">
	      <input type="password" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
	    </div>
	    <div class="layui-form-mid layui-word-aux">辅助文字</div>
	  </div>-->
	 
	  <div class="layui-form-item">
	    <div class="layui-input-block">
	      <button class="layui-btn" onclick="xxx()" type="button">修改电话</button>
	      <button type="button" onclick="biu()" class="layui-btn layui-btn-danger">修改密码</button>
	    </div>
	  </div>
	</form>
 
</body>
</html>